#include "main_loop.h"
#include "pwm.h"

extern TIM_HandleTypeDef htim2;
void PWMInit(void)
{
    HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_1);
    HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_2);
    HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_3);
}
void PWM_OUT(uint8_t channel, uint32_t out_data)
{
    switch (channel)
    {
    case 1:
        __HAL_TIM_SetCompare(&htim2, TIM_CHANNEL_1, out_data);
        break;
    case 2:
        __HAL_TIM_SetCompare(&htim2, TIM_CHANNEL_2, out_data);
        break;
    case 3:
        __HAL_TIM_SetCompare(&htim2, TIM_CHANNEL_3, out_data);
        break;
    default:
        break;
    }
}